<?php
$file_path = realpath('log.txt');
function mreadFile() {
    global $file_path;
    $file = fopen($file_path, 'r');
    $row = 0;
    if(!feof($file)) {
        $row = fgets($file);
    }
    fclose($file);
    //
    return $row;
}

function mwriteFile($log) {
    global $file_path;
    $file = fopen($file_path, 'w');
    fwrite($file, $log);
    fclose($file);    
}

function mwriteLogs() {
    global $file_path;
    $log = mreadFile();
    $log = intval($log) + 1;
    mwriteFile($log);
    return $log;
}
